/*** Useful functions ***/
#define idx(r, c, SIZE_W) (c + r*SIZE_W)
#define abs(X) ((X) > 0 ? (X) : -(X))
#define min(a,b) ( ((a) > (b)) ? (a) : (b) )
#define max(a,b) ( ((a) > (b)) ? (b) : (a) )
#define round(x) ((int) (((float)(x)) + 0.5f))
#define ceil(x) ((int) (((float)(x)) + 0.99f))
#define floor(x) ((int) (((float)(x)) - 0.01f))

/*** SPE functions ***/
#define waitDMA(tag) mfc_write_tag_mask(1<<tag); mfc_read_tag_status_all();

